function myInstanceOf(obj,fn){
    if(obj === null && typeof obj !== 'object')return false
    if(typeof fn!=='function'&&!fn.prototype){
        throw new TypeError("Function has non-object prototype 'undefined' in instanceof check")
    }

    let temp=fn.prototype
    while(obj!==null){
        if(Object.getPrototypeOf(obj)===temp){//返回指定对象的原型（即内部 [[Prototype]] 属性的值）。
            return true
        }
        obj=Object.getPrototypeOf(obj)
    }
    return false
}

let obj={}
function F(){

}
let D=new F()
console.log(myInstanceOf(D,F));
